from dataclasses import dataclass
import time
import diffusers
import transformers
from installer import log


@dataclass
class Model():
    name: str
    url: str = ''
    repo: str = None
    repo_cls: classmethod = None
    repo_revision: str = None
    dit: str = None
    dit_cls: classmethod = None
    dit_folder: str = 'transformer'
    dit_revision: str = None
    te: str = None
    te_cls: classmethod = None
    te_folder: str = 'text_encoder'
    te_hijack: bool = True
    te_revision: str = None
    image_hijack: bool = True
    vae_hijack: bool = True
    vae_remote: bool = False

    def __str__(self):
        return f'name="{self.name}" url="{self.url}" repo="{self.repo}" repo_cls="{self.repo_cls}" dit="{self.dit}" dit_cls="{self.dit_cls}" dit_folder="{self.dit_folder}" te="{self.te}" te_cls="{self.te_cls}" te_folder="{self.te_folder}" te_hijack={self.te_hijack} vae_hijack={self.vae_hijack} vae_remote={self.vae_remote}'


try:
    t0 = time.time()
    models = {
        'None': [],
        'Hunyuan Video': [
            Model(name='None'),
            Model(name='Hunyuan Video T2V',
                url='https://huggingface.co/tencent/HunyuanVideo',
                vae_remote=True,
                repo='hunyuanvideo-community/HunyuanVideo',
                repo_cls=getattr(diffusers, 'HunyuanVideoPipeline', None),
                te_cls=getattr(transformers, 'LlamaModel', None),
                dit_cls=getattr(diffusers, 'HunyuanVideoTransformer3DModel', None)),
            Model(name='Hunyuan Video I2V', # https://github.com/huggingface/diffusers/pull/10983
                url='https://huggingface.co/tencent/HunyuanVideo-I2V',
                vae_remote=True,
                repo='hunyuanvideo-community/HunyuanVideo-I2V',
                repo_cls=getattr(diffusers, 'HunyuanVideoImageToVideoPipeline', None),
                te_cls=getattr(transformers, 'LlavaForConditionalGeneration', None),
                dit_cls=getattr(diffusers, 'HunyuanVideoTransformer3DModel', None)),
            Model(name='SkyReels Hunyuan T2V', # https://github.com/huggingface/diffusers/pull/10837
                url='https://huggingface.co/Skywork/SkyReels-V1-Hunyuan-T2V',
                vae_remote=True,
                repo='hunyuanvideo-community/HunyuanVideo',
                repo_cls=getattr(diffusers, 'HunyuanVideoPipeline', None),
                te_cls=getattr(transformers, 'LlamaModel', None),
                dit='Skywork/SkyReels-V1-Hunyuan-T2V',
                dit_folder=None,
                dit_cls=getattr(diffusers, 'HunyuanVideoTransformer3DModel', None)),
            Model(name='SkyReels Hunyuan I2V', # https://github.com/huggingface/diffusers/pull/10837
                url='https://huggingface.co/Skywork/SkyReels-V1-Hunyuan-I2V',
                vae_remote=True,
                repo='hunyuanvideo-community/HunyuanVideo',
                repo_cls=getattr(diffusers, 'HunyuanSkyreelsImageToVideoPipeline', None),
                te_cls=getattr(transformers, 'LlamaModel', None),
                dit='Skywork/SkyReels-V1-Hunyuan-I2V',
                dit_folder=None,
                dit_cls=getattr(diffusers, 'HunyuanVideoTransformer3DModel', None)),
            Model(name='Fast Hunyuan T2V', # https://github.com/hao-ai-lab/FastVideo/blob/8a77cf22c9b9e7f931f42bc4b35d21fd91d24e45/fastvideo/models/hunyuan/inference.py#L213
                url='https://huggingface.co/FastVideo/FastHunyuan',
                vae_remote=True,
                repo='hunyuanvideo-community/HunyuanVideo',
                repo_cls=getattr(diffusers, 'HunyuanVideoPipeline', None),
                te_cls=getattr(transformers, 'LlamaModel', None),
                dit='FastVideo/FastHunyuan-diffusers',
                dit_cls=getattr(diffusers, 'HunyuanVideoTransformer3DModel', None)),
        ],
        'LTX Video': [
            Model(name='None'),
            Model(name='LTXVideo 0.9.8 13B',
                url='https://huggingface.co/Lightricks/LTX-Video-0.9.8-13B-distilled',
                repo='Lightricks/LTX-Video-0.9.8-13B-distilled',
                repo_cls=getattr(diffusers, 'LTXConditionPipeline', None),
                te_cls=getattr(transformers, 'T5EncoderModel', None),
                dit_cls=getattr(diffusers, 'LTXVideoTransformer3DModel', None)),
            Model(name='LTXVideo 0.9.7 13B',
                url='https://huggingface.co/Lightricks/LTX-Video-0.9.7-dev',
                repo='a-r-r-o-w/LTX-Video-0.9.7-diffusers',
                repo_cls=getattr(diffusers, 'LTXConditionPipeline', None),
                te_cls=getattr(transformers, 'T5EncoderModel', None),
                dit_cls=getattr(diffusers, 'LTXVideoTransformer3DModel', None)),
            Model(name='LTXVideo 0.9.6 2B T2V',
                url='https://huggingface.co/Lightricks/LTX-Video',
                repo='Lightricks/LTX-Video',
                repo_cls=getattr(diffusers, 'LTXConditionPipeline', None),
                te_cls=getattr(transformers, 'T5EncoderModel', None),
                dit_cls=getattr(diffusers, 'LTXVideoTransformer3DModel', None)),
            Model(name='LTXVideo 0.9.6 2B I2V',
                url='https://huggingface.co/Lightricks/LTX-Video',
                repo='Lightricks/LTX-Video',
                repo_cls=getattr(diffusers, 'LTXConditionPipeline', None),
                te_cls=getattr(transformers, 'T5EncoderModel', None),
                dit_cls=getattr(diffusers, 'LTXVideoTransformer3DModel', None)),
            Model(name='LTXVideo 0.9.6 2B T2V Distilled',
                url='https://huggingface.co/Lightricks/LTX-Video-2B-0.9.6-Distilled-04-25',
                repo='Lightricks/LTX-Video-2B-0.9.6-Distilled-04-25',
                repo_cls=getattr(diffusers, 'LTXConditionPipeline', None),
                te_cls=getattr(transformers, 'T5EncoderModel', None),
                dit_cls=getattr(diffusers, 'LTXVideoTransformer3DModel', None)),
            Model(name='LTXVideo 0.9.6 2B I2V Distilled',
                url='https://huggingface.co/Lightricks/LTX-Video-2B-0.9.6-Distilled-04-25',
                repo='Lightricks/LTX-Video-2B-0.9.6-Distilled-04-25',
                repo_cls=getattr(diffusers, 'LTXConditionPipeline', None),
                te_cls=getattr(transformers, 'T5EncoderModel', None),
                dit_cls=getattr(diffusers, 'LTXVideoTransformer3DModel', None)),
            Model(name='LTXVideo 0.9.5 T2V', # https://github.com/huggingface/diffusers/pull/10968
                url='https://huggingface.co/Lightricks/LTX-Video-0.9.5',
                repo='Lightricks/LTX-Video-0.9.5',
                repo_cls=getattr(diffusers, 'LTXConditionPipeline', None),
                te_cls=getattr(transformers, 'T5EncoderModel', None),
                dit_cls=getattr(diffusers, 'LTXVideoTransformer3DModel', None)),
            Model(name='LTXVideo 0.9.5 I2V',
                url='https://huggingface.co/Lightricks/LTX-Video-0.9.5',
                repo='Lightricks/LTX-Video-0.9.5',
                repo_cls=getattr(diffusers, 'LTXConditionPipeline', None),
                te_cls=getattr(transformers, 'T5EncoderModel', None),
                dit_cls=getattr(diffusers, 'LTXVideoTransformer3DModel', None)),
            Model(name='LTXVideo 0.9.1 T2V',
                url='https://huggingface.co/a-r-r-o-w/LTX-Video-0.9.1-diffusers',
                repo='a-r-r-o-w/LTX-Video-0.9.1-diffusers',
                repo_cls=getattr(diffusers, 'LTXPipeline', None),
                te_cls=getattr(transformers, 'T5EncoderModel', None),
                dit_cls=getattr(diffusers, 'LTXVideoTransformer3DModel', None)),
            Model(name='LTXVideo 0.9.1 I2V',
                url='https://huggingface.co/a-r-r-o-w/LTX-Video-0.9.1-diffusers',
                repo='a-r-r-o-w/LTX-Video-0.9.1-diffusers',
                repo_cls=getattr(diffusers, 'LTXImageToVideoPipeline', None),
                te_cls=getattr(transformers, 'T5EncoderModel', None),
                dit_cls=getattr(diffusers, 'LTXVideoTransformer3DModel', None)),
            Model(name='LTXVideo 0.9.0 T2V',
                url='https://huggingface.co/a-r-r-o-w/LTX-Video-diffusers',
                repo='a-r-r-o-w/LTX-Video-diffusers',
                repo_cls=getattr(diffusers, 'LTXPipeline', None),
                te_cls=getattr(transformers, 'T5EncoderModel', None),
                dit_cls=getattr(diffusers, 'LTXVideoTransformer3DModel', None)),
            Model(name='LTXVideo 0.9.0 I2V',
                url='https://huggingface.co/a-r-r-o-w/LTX-Video-diffusers',
                repo='a-r-r-o-w/LTX-Video-diffusers',
                repo_cls=getattr(diffusers, 'LTXImageToVideoPipeline', None),
                te_cls=getattr(transformers, 'T5EncoderModel', None),
                dit_cls=getattr(diffusers, 'LTXVideoTransformer3DModel', None)),
        ],
        'WAN Video': [
            Model(name='None'),
            Model(name='WAN 2.2 5B T2V',
                url='https://huggingface.co/Wan-AI/Wan2.2-TI2V-5B-Diffusers',
                repo='Wan-AI/Wan2.2-TI2V-5B-Diffusers',
                repo_cls=getattr(diffusers, 'WanPipeline', None),
                te_cls=getattr(transformers, 'UMT5EncoderModel', None),
                dit_cls=getattr(diffusers, 'WanTransformer3DModel', None)),
            Model(name='WAN 2.2 5B I2V',
                url='https://huggingface.co/Wan-AI/Wan2.2-TI2V-5B-Diffusers',
                repo='Wan-AI/Wan2.2-TI2V-5B-Diffusers',
                repo_cls=getattr(diffusers, 'WanImageToVideoPipeline', None),
                te_cls=getattr(transformers, 'UMT5EncoderModel', None),
                dit_cls=getattr(diffusers, 'WanTransformer3DModel', None)),
            Model(name='WAN 2.2 A14B T2V',
                url='https://huggingface.co/Wan-AI/Wan2.2-T2V-A14B-Diffusers',
                repo='Wan-AI/Wan2.2-T2V-A14B-Diffusers',
                repo_cls=getattr(diffusers, 'WanPipeline', None),
                te_cls=getattr(transformers, 'UMT5EncoderModel', None),
                dit_cls=getattr(diffusers, 'WanTransformer3DModel', None),
                dit_folder=("transformer", "transformer_2")),
            Model(name='WAN 2.2 A14B I2V',
                url='https://huggingface.co/Wan-AI/Wan2.2-I2V-A14B-Diffusers',
                repo='Wan-AI/Wan2.2-I2V-A14B-Diffusers',
                repo_cls=getattr(diffusers, 'WanImageToVideoPipeline', None),
                te_cls=getattr(transformers, 'UMT5EncoderModel', None),
                dit_cls=getattr(diffusers, 'WanTransformer3DModel', None),
                dit_folder=("transformer", "transformer_2")),
            Model(name='WAN 2.2 A14B SDNQ T2V',
                url='https://huggingface.co/Disty0/Wan2.2-T2V-A14B-SDNQ-uint4-svd-r32',
                repo='Disty0/Wan2.2-T2V-A14B-SDNQ-uint4-svd-r32',
                repo_cls=getattr(diffusers, 'WanPipeline', None),
                te_cls=getattr(transformers, 'UMT5EncoderModel', None),
                dit_cls=getattr(diffusers, 'WanTransformer3DModel', None),
                dit_folder=("transformer", "transformer_2")),
            Model(name='WAN 2.2 A14B SDNQ I2V',
                url='https://huggingface.co/Disty0/Wan2.2-I2V-A14B-SDNQ-uint4-svd-r32',
                repo='Disty0/Wan2.2-I2V-A14B-SDNQ-uint4-svd-r32',
                repo_cls=getattr(diffusers, 'WanImageToVideoPipeline', None),
                te_cls=getattr(transformers, 'UMT5EncoderModel', None),
                dit_cls=getattr(diffusers, 'WanTransformer3DModel', None),
                dit_folder=("transformer", "transformer_2")),
            Model(name='WAN 2.2 14B VACE',
                url='https://huggingface.co/linoyts/Wan2.2-VACE-Fun-14B-diffusers',
                repo='linoyts/Wan2.2-VACE-Fun-14B-diffusers',
                repo_cls=getattr(diffusers, 'WanVACEPipeline', None),
                te_cls=getattr(transformers, 'UMT5EncoderModel', None),
                dit_cls=getattr(diffusers, 'WanVACETransformer3DModel', None),
                dit_folder=("transformer", "transformer_2")),
            Model(name='WAN 2.1 1.3B T2V',
                url='https://huggingface.co/Wan-AI/Wan2.1-T2V-1.3B-Diffusers',
                repo='Wan-AI/Wan2.1-T2V-1.3B-Diffusers',
                repo_cls=getattr(diffusers, 'WanPipeline', None),
                te_cls=getattr(transformers, 'UMT5EncoderModel', None),
                dit_cls=getattr(diffusers, 'WanTransformer3DModel', None)),
            Model(name='WAN 2.1 14B T2V',
                url='https://huggingface.co/Wan-AI/Wan2.1-T2V-14B-Diffusers',
                repo='Wan-AI/Wan2.1-T2V-14B-Diffusers',
                repo_cls=getattr(diffusers, 'WanPipeline', None),
                te_cls=getattr(transformers, 'UMT5EncoderModel', None),
                dit_cls=getattr(diffusers, 'WanTransformer3DModel', None)),
            Model(name='WAN 2.1 14B I2V 480p',
                url='https://huggingface.co/Wan-AI/Wan2.1-I2V-14B-480P-Diffusers',
                repo='Wan-AI/Wan2.1-I2V-14B-480P-Diffusers',
                repo_cls=getattr(diffusers, 'WanImageToVideoPipeline', None),
                te_cls=getattr(transformers, 'UMT5EncoderModel', None),
                dit_cls=getattr(diffusers, 'WanTransformer3DModel', None)),
            Model(name='WAN 2.1 14B I2V 720p',
                url='https://huggingface.co/Wan-AI/Wan2.1-I2V-14B-720P-Diffusers',
                repo='Wan-AI/Wan2.1-I2V-14B-720P-Diffusers',
                repo_cls=getattr(diffusers, 'WanImageToVideoPipeline', None),
                te_cls=getattr(transformers, 'UMT5EncoderModel', None),
                dit_cls=getattr(diffusers, 'WanTransformer3DModel', None)),
            Model(name='WAN 2.1 14B FLF2V 720p',
                url='https://huggingface.co/Wan-AI/Wan2.1-FLF2V-14B-720P',
                repo='Wan-AI/Wan2.1-FLF2V-14B-720P-diffusers',
                repo_cls=getattr(diffusers, 'WanImageToVideoPipeline', None),
                te_cls=getattr(transformers, 'UMT5EncoderModel', None),
                dit_cls=getattr(diffusers, 'WanTransformer3DModel', None)),
            Model(name='WAN 2.1 VACE 1.3B',
                url='https://huggingface.co/Wan-AI/Wan2.1-VACE-1.3B-diffusers',
                repo='Wan-AI/Wan2.1-VACE-1.3B-diffusers',
                repo_cls=getattr(diffusers, 'WanVACEPipeline', None),
                te_cls=getattr(transformers, 'UMT5EncoderModel', None),
                dit_cls=getattr(diffusers, 'WanVACETransformer3DModel', None)),
            Model(name='WAN 2.1 VACE 14B',
                url='https://huggingface.co/Wan-AI/Wan2.1-VACE-14B-diffusers',
                repo='Wan-AI/Wan2.1-VACE-14B-diffusers',
                repo_cls=getattr(diffusers, 'WanVACEPipeline', None),
                te_cls=getattr(transformers, 'UMT5EncoderModel', None),
                dit_cls=getattr(diffusers, 'WanVACETransformer3DModel', None)),
        ],
        'SkyReels V2': [
            Model(name='None'),
            Model(name='SkyReels-V2 T2V-DF 1.3B-540P',
                url='https://huggingface.co/Skywork/SkyReels-V2-DF-1.3B-540P-Diffusers',
                repo='Skywork/SkyReels-V2-DF-1.3B-540P-Diffusers',
                repo_cls=getattr(diffusers, 'SkyReelsV2DiffusionForcingPipeline', None),
                repo_revision='refs/pr/1',
                te_cls=getattr(transformers, 'UMT5EncoderModel', None),
                dit_cls=getattr(diffusers, 'SkyReelsV2Transformer3DModel', None)),
            Model(name='SkyReels-V2 T2V-DF 14B-720P',
                url='https://huggingface.co/Skywork/SkyReels-V2-DF-14B-720P-Diffusers',
                repo='Skywork/SkyReels-V2-DF-14B-720P-Diffusers',
                repo_cls=getattr(diffusers, 'SkyReelsV2DiffusionForcingPipeline', None),
                repo_revision='refs/pr/1',
                te_cls=getattr(transformers, 'UMT5EncoderModel', None),
                dit_cls=getattr(diffusers, 'SkyReelsV2Transformer3DModel', None)),
            Model(name='SkyReels-V2 I2V-DF 14B-720P',
                url='https://huggingface.co/Skywork/SkyReels-V2-DF-14B-720P-Diffusers',
                repo='Skywork/SkyReels-V2-DF-14B-720P-Diffusers',
                repo_cls=getattr(diffusers, 'SkyReelsV2DiffusionForcingImageToVideoPipeline', None),
                repo_revision='refs/pr/1',
                te_cls=getattr(transformers, 'UMT5EncoderModel', None),
                dit_cls=getattr(diffusers, 'SkyReelsV2Transformer3DModel', None)),
            Model(name='SkyReels-V2 T2V 14B-720P',
                url='https://huggingface.co/Skywork/SkyReels-V2-T2V-14B-720P-Diffusers',
                repo='Skywork/SkyReels-V2-T2V-14B-720P-Diffusers',
                repo_cls=getattr(diffusers, 'SkyReelsV2Pipeline', None),
                repo_revision='refs/pr/1',
                te_cls=getattr(transformers, 'UMT5EncoderModel', None),
                dit_cls=getattr(diffusers, 'SkyReelsV2Transformer3DModel', None)),
            Model(name='SkyReels-V2 I2V 14B-720P',
                url='https://huggingface.co/Skywork/SkyReels-V2-I2V-14B-720P-Diffusers',
                repo='Skywork/SkyReels-V2-I2V-14B-720P-Diffusers',
                repo_cls=getattr(diffusers, 'SkyReelsV2ImageToVideoPipeline', None),
                repo_revision='refs/pr/1',
                te_cls=getattr(transformers, 'UMT5EncoderModel', None),
                dit_cls=getattr(diffusers, 'SkyReelsV2Transformer3DModel', None)),
        ],
        'Mochi Video': [
            Model(name='None'),
            Model(name='Mochi 1 T2V',
                url='https://huggingface.co/genmo/mochi-1-preview',
                repo='genmo/mochi-1-preview',
                repo_cls=getattr(diffusers, 'MochiPipeline', None),
                te_cls=getattr(transformers, 'T5EncoderModel', None),
                dit_cls=getattr(diffusers, 'MochiTransformer3DModel', None)),
        ],
        'Latte Video': [
            Model(name='None'),
            Model(name='Latte 1 T2V',
                url='https://huggingface.co/maxin-cn/Latte-1',
                repo='maxin-cn/Latte-1',
                repo_cls=getattr(diffusers, 'LattePipeline', None),
                te_cls=getattr(transformers, 'T5EncoderModel', None),
                dit_cls=getattr(diffusers, 'LatteTransformer3DModel', None)),
        ],
        'Allegro Video': [
            Model(name='None'),
            Model(name='Allegro T2V',
                url='https://huggingface.co/rhymes-ai/Allegro',
                repo='rhymes-ai/Allegro',
                repo_cls=getattr(diffusers, 'AllegroPipeline', None),
                te_cls=getattr(transformers, 'T5EncoderModel', None),
                dit_cls=getattr(diffusers, 'AllegroTransformer3DModel', None)),
        ],
        'Cog Video': [
            Model(name='None'),
            Model(name='CogVideoX 1.0 2B T2V',
                url='https://huggingface.co/THUDM/CogVideoX-2b',
                repo='THUDM/CogVideoX-2b',
                repo_cls=getattr(diffusers, 'CogVideoXPipeline', None),
                te_cls=getattr(transformers, 'T5EncoderModel', None),
                dit_cls=getattr(diffusers, 'CogVideoXTransformer3DModel', None)),
            Model(name='CogVideoX 1.0 5B T2V',
                url='https://huggingface.co/THUDM/CogVideoX-5b',
                repo='THUDM/CogVideoX-5b',
                repo_cls=getattr(diffusers, 'CogVideoXPipeline', None),
                te_cls=getattr(transformers, 'T5EncoderModel', None),
                dit_cls=getattr(diffusers, 'CogVideoXTransformer3DModel', None)),
            Model(name='CogVideoX 1.0 5B I2V',
                url='https://huggingface.co/THUDM/CogVideoX-5b-I2V',
                repo='THUDM/CogVideoX-5b-I2V',
                repo_cls=getattr(diffusers, 'CogVideoXImageToVideoPipeline', None),
                te_cls=getattr(transformers, 'T5EncoderModel', None),
                dit_cls=getattr(diffusers, 'CogVideoXTransformer3DModel', None)),
            Model(name='CogVideoX 1.5 5B T2V',
                url='https://huggingface.co/THUDM/CogVideoX1.5-5B',
                repo='THUDM/CogVideoX1.5-5B',
                repo_cls=getattr(diffusers, 'CogVideoXPipeline', None),
                te_cls=getattr(transformers, 'T5EncoderModel', None),
                dit_cls=getattr(diffusers, 'CogVideoXTransformer3DModel', None)),
            Model(name='CogVideoX 1.5 5B I2V',
                url='https://huggingface.co/THUDM/CogVideoX1.5-5B-I2V',
                repo='THUDM/CogVideoX1.5-5B-I2V',
                repo_cls=getattr(diffusers, 'CogVideoXImageToVideoPipeline', None),
                te_cls=getattr(transformers, 'T5EncoderModel', None),
                dit_cls=getattr(diffusers, 'CogVideoXTransformer3DModel', None)),
            Model(name='Index Anisora 1.0 5B I2V',
                url='https://huggingface.co/Disty0/Index-anisora-5B-diffusers',
                repo='Disty0/Index-anisora-5B-diffusers',
                repo_cls=getattr(diffusers, 'CogVideoXImageToVideoPipeline', None),
                te_cls=getattr(transformers, 'T5EncoderModel', None),
                dit_cls=getattr(diffusers, 'CogVideoXTransformer3DModel', None)),
            Model(name='Index Anisora 1.0 5B RL I2V',
                url='https://huggingface.co/Disty0/Index-anisora-5B_RL-diffusers',
                repo='Disty0/Index-anisora-5B_RL-diffusers',
                repo_cls=getattr(diffusers, 'CogVideoXImageToVideoPipeline', None),
                te_cls=getattr(transformers, 'T5EncoderModel', None),
                dit_cls=getattr(diffusers, 'CogVideoXTransformer3DModel', None)),
        ],
        'nVidia Cosmos': [
            Model(name='nvidia Cosmos Predict2 2B I2V',
                url='https://huggingface.co/nvidia/Cosmos-Predict2-2B-Text2Image',
                repo='nvidia/Cosmos-Predict2-2B-Video2World',
                repo_cls=getattr(diffusers, 'Cosmos2VideoToWorldPipeline', None),
                te_cls=getattr(transformers, 'T5EncoderModel', None),
                dit_cls=getattr(diffusers, 'CosmosTransformer3DModel', None)),
            Model(name='nvidia Cosmos Predict2 2B I2V',
                url='https://huggingface.co/nvidia/Cosmos-Predict2-2B-Text2Image',
                repo='nvidia/Cosmos-Predict2-2B-Video2World',
                repo_cls=getattr(diffusers, 'Cosmos2VideoToWorldPipeline', None),
                te_cls=getattr(transformers, 'T5EncoderModel', None),
                dit_cls=getattr(diffusers, 'CosmosTransformer3DModel', None)),
        ],
        'nVidia SANA': [
            Model(name='SANA Video 2B 480p T2V',
                url='https://huggingface.co/Efficient-Large-Model/SANA-Video_2B_480p_diffusers',
                repo='Efficient-Large-Model/SANA-Video_2B_480p_diffusers',
                repo_cls=getattr(diffusers, 'SanaVideoPipeline', None),
                te_cls=getattr(transformers, 'Gemma2Model', None),
                dit_cls=getattr(diffusers, 'SanaVideoTransformer3DModel', None)),
        ],
        'Kandinsky': [
            Model(name='Kandinsky 5.0 Lite 5s SFT T2V',
                url='https://huggingface.co/ai-forever/Kandinsky-5.0-T2V-Lite-sft-5s-Diffusers',
                repo='ai-forever/Kandinsky-5.0-T2V-Lite-sft-5s-Diffusers',
                repo_cls=getattr(diffusers, 'Kandinsky5T2VPipeline', None),
                te_cls=getattr(transformers, 'Qwen2_5_VLForConditionalGeneration', None),
                dit_cls=getattr(diffusers, 'Kandinsky5Transformer3DModel', None)),
            Model(name='Kandinsky 5.0 Lite 5s CFG-distilled T2V',
                url='https://huggingface.co/ai-forever/Kandinsky-5.0-T2V-Lite-nocfg-5s-Diffusers',
                repo='ai-forever/Kandinsky-5.0-T2V-Lite-nocfg-5s-Diffusers',
                repo_cls=getattr(diffusers, 'Kandinsky5T2VPipeline', None),
                te_cls=getattr(transformers, 'Qwen2_5_VLForConditionalGeneration', None),
                dit_cls=getattr(diffusers, 'Kandinsky5Transformer3DModel', None)),
            Model(name='Kandinsky 5.0 Lite 5s Steps-distilled T2V',
                url='https://huggingface.co/ai-forever/Kandinsky-5.0-T2V-Lite-distilled16steps-5s-Diffusers',
                repo='ai-forever/Kandinsky-5.0-T2V-Lite-distilled16steps-5s-Diffusers',
                repo_cls=getattr(diffusers, 'Kandinsky5T2VPipeline', None),
                te_cls=getattr(transformers, 'Qwen2_5_VLForConditionalGeneration', None),
                dit_cls=getattr(diffusers, 'Kandinsky5Transformer3DModel', None)),
            Model(name='Kandinsky 5.0 Lite 10s SFT T2V',
                url='https://huggingface.co/ai-forever/Kandinsky-5.0-T2V-Lite-sft-10s-Diffusers',
                repo='ai-forever/Kandinsky-5.0-T2V-Lite-sft-10s-Diffusers',
                repo_cls=getattr(diffusers, 'Kandinsky5T2VPipeline', None),
                te_cls=getattr(transformers, 'Qwen2_5_VLForConditionalGeneration', None),
                dit_cls=getattr(diffusers, 'Kandinsky5Transformer3DModel', None)),
            Model(name='Kandinsky 5.0 Lite 10s CFG-distilled T2V',
                url='https://huggingface.co/ai-forever/Kandinsky-5.0-T2V-Lite-nocfg-10s-Diffusers',
                repo='ai-forever/Kandinsky-5.0-T2V-Lite-nocfg-10s-Diffusers',
                repo_cls=getattr(diffusers, 'Kandinsky5T2VPipeline', None),
                te_cls=getattr(transformers, 'Qwen2_5_VLForConditionalGeneration', None),
                dit_cls=getattr(diffusers, 'Kandinsky5Transformer3DModel', None)),
            Model(name='Kandinsky 5.0 Lite 10s Steps-distilled T2V',
                url='https://huggingface.co/ai-forever/Kandinsky-5.0-T2V-Lite-distilled16steps-10s-Diffusers',
                repo='ai-forever/Kandinsky-5.0-T2V-Lite-distilled16steps-10s-Diffusers',
                repo_cls=getattr(diffusers, 'Kandinsky5T2VPipeline', None),
                te_cls=getattr(transformers, 'Qwen2_5_VLForConditionalGeneration', None),
                dit_cls=getattr(diffusers, 'Kandinsky5Transformer3DModel', None)),
        ],
    }
    t1 = time.time()
    errors = 0
    total = 0
    for model in models.values():
        for m in model:
            if m.name == 'None':
                continue
            if (m.repo_cls is None) or (m.dit_cls is None) or (m.te_cls is None):
                log.error(f'Video: pipeline="{m.name}" not available')
                errors += 1
            else:
                total += 1
    log.info(f'Networks: type="video" engines={len(models)} models={total} errors={errors} time={t1 - t0:.2f}')
except Exception as e:
    models = {}
    log.error(f'Networks: type="video" {e}')
